/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vehicle.bol;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import vehicle.dal.DAL;
import vehicle.entity.TypeVehicle;

/**
 *
 * @author caodangtinh
 */
public class TypeBol {
    public List<TypeVehicle> getTypeVehicle() {
        DAL dal = new DAL();
        List<TypeVehicle> listType = new ArrayList<TypeVehicle>();
        ArrayList li = new ArrayList();
        TypeVehicle typeVehicle =null;
        try {
            ResultSet rs = dal.executeQuery("usp_getall_type", li);
            while (rs.next()) {
                typeVehicle = new TypeVehicle();
                typeVehicle.setTypeID(rs.getInt("TypeID"));
                typeVehicle.setTypeName(rs.getString("TypeName"));
                listType.add(typeVehicle);
            }
        } catch (Exception e) {
        } finally {
            dal.closeConnection();
        }
        return listType;
    }
}
